package avicit.bdp.dcs.desensitization.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2021-08-02
 * @类说明：DataMaskingMethodDto
 * @修改记录：
 * @注意事项：
 * @主要功能：数据脱敏常用算法DTO
 */
@ApiModel(value = "DataMaskingMethodDto", description = "bdp_dcs_data_masking_method")
@Table(name = "bdp_dcs_data_masking_method")
public class DataMaskingMethodDto extends BaseDTO {
    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 脱敏算法名称
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法名称")
    @FieldRemark(column = "name", field = "name", name = "权限名称")
    @Column(name = "name")
    private String name;

    /**
     * DataX中脱敏方法名称
     */
    @LogField
    @ApiModelProperty(value = "DataX中脱敏方法名称")
    @FieldRemark(column = "func_name", field = "func_name", name = "权限分类")
    @Column(name = "func_name")
    private String funcName;

    /**
     * DataX中脱敏方法内部类型
     */
    @LogField
    @ApiModelProperty(value = "DataX中脱敏方法内部类型")
    @FieldRemark(column = "inner_type", field = "inner_type", name = "DataX中脱敏方法内部类型")
    @Column(name = "inner_type")
    private String innerType;

    /**
     * 脱敏算法类型，包括哈希、掩码、变换、加密四种类型
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法类型")
    @FieldRemark(column = "algo_type", field = "algo_type", name = "脱敏算法类型")
    @Column(name = "algo_type")
    private String algoType;

    /**
     * 脱敏算法描述
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法描述")
    @FieldRemark(column = "remark", field = "remark", name = "权限描述")
    @Column(name = "remark")
    private String remark;

    /**
     * 适用场景
     */
    @LogField
    @ApiModelProperty(value = "脱敏算法描述")
    @FieldRemark(column = "applicable_scene", field = "applicable_scene", name = "脱敏算法描述")
    @Column(name = "applicable_scene")
    private String applicableScene;

    /**
     * 输入参数
     */
    @ApiModelProperty(value = "输入参数")
    @Transient
    private String paras;

    public DataMaskingMethodDto() {
    }

    public DataMaskingMethodDto(Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.funcName = builder.funcName;
        this.innerType = builder.innerType;
        this.algoType = builder.algoType;
        this.remark = builder.remark;
        this.applicableScene = builder.applicableScene;
        this.paras = builder.paras;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getFuncName() {
        return funcName;
    }

    public String getInnerType() {
        return innerType;
    }

    public String getAlgoType() {
        return algoType;
    }

    public String getRemark() {
        return remark;
    }

    public String getApplicableScene() {
        return applicableScene;
    }

    public String getParas() {
        return paras;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setFuncName(String funcName) {
        this.funcName = funcName;
    }

    public void setInnerType(String innerType) {
        this.innerType = innerType;
    }

    public void setAlgoType(String algoType) {
        this.algoType = algoType;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public void setApplicableScene(String applicableScene) {
        this.applicableScene = applicableScene;
    }

    public void setParas(String paras) {
        this.paras = paras;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "脱敏算法模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "脱敏算法";
        } else {
            return super.logTitle;
        }
    }

    /**
     * Builder构造类
     */
    public static final class Builder {
        private String id;
        private String name;
        private String funcName;
        private String innerType;
        private String algoType;
        private String remark;
        private String applicableScene;
        private String paras;

        private Builder() {
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder funcName(String funcName) {
            this.funcName = funcName;
            return this;
        }

        public Builder innerType(String innerType) {
            this.innerType = innerType;
            return this;
        }

        public Builder algoType(String algoType) {
            this.algoType = algoType;
            return this;
        }

        public Builder remark(String remark) {
            this.remark = remark;
            return this;
        }

        public Builder applicableScene(String applicableScene) {
            this.applicableScene = applicableScene;
            return this;
        }

        public Builder paras(String paras) {
            this.paras = paras;
            return this;
        }

        public DataMaskingMethodDto build() {
            DataMaskingMethodDto dataMaskingMethodDto = new DataMaskingMethodDto();
            dataMaskingMethodDto.setId(id);
            dataMaskingMethodDto.setName(name);
            dataMaskingMethodDto.setFuncName(funcName);
            dataMaskingMethodDto.setInnerType(innerType);
            dataMaskingMethodDto.setAlgoType(algoType);
            dataMaskingMethodDto.setRemark(remark);
            dataMaskingMethodDto.setApplicableScene(applicableScene);
            dataMaskingMethodDto.setParas(paras);

            return dataMaskingMethodDto;
        }
    }
}
